<div class="">
    <div class="admin_nrtop">
        <div class="ad_search">
            <div class="search">
                <form action="/admini/system/sms/"  method="get" style="margin:0px" id="form1">
                    <div class="soubox">
                        <input type="text" id="phone" name="phone" value="<?php echo $this->phone?$this->phone:"";?>" placeholder="输入手机号">
                    </div>
                    <a href="javascript:$('#form1').submit();"><span>搜索</span></a>
                </form>
                <label id="balance"></label>
            </div>
            <input type="button" id="button" value="查询短信余额" />
        </div>
    </div>
    <div class="adminvip">
        <?php if($this->smslist){ ?> 
        <table width="90%" border="1">
              <tr>
                    <td width="5%">记录id</td>
                    <td width="5%">类型</td>
                    <td width="8%">手机号</td>
                    <td width="8%">状态</td>
                    <td width="10%">ip</td>
                    <td>返回结果</td>
                    <td width="10%">发送时间</td>
                    <td width="10%">过期时间</td>
              </tr>
            <?php foreach ($this->smslist as $sms) { ?> 
              <tr>
                    <td><?php echo $sms->Id;?></td>
                    <td><?php echo $sms->Type == 1 ? '手机注册' : '其他' ;?></td>
                    <td><?php echo $sms->Phone;?></td>
                    <td><?php echo $sms->State == 1 && time() < $sms->Endtime ? '<span style="color:red">可用</span>' : '失效';?></td>
                    <td><?php echo long2ip($sms->Ip);?></td>
                    <td><?php echo $sms->Result == 'false' ? '<span style="color:red">短信发送失败</span>' : $sms->Result ;?></td>
                    <td><?php echo date("Y-m-d h:i:s", $sms->Time);?></td>
                    <td><?php echo date("Y-m-d h:i:s", $sms->Endtime);?></td>
            </tr>
            <?php } ?>
        </table>
        <?php } ?>
        <div style="clear:both"></div>
    </div>
    <div class="ccbar">
        <?php
        echo $this->partial('paging.phtml', array("pages" => $this->smslistAll,"pamas"=>"phone=$this->phone&type=$this->ptype"));
        ?>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        $('#button').click(function(){
            if(confirm("查询短信余额","提示信息")){
                $.ajax({
                    type: 'get',
                    url: '/admini/system/smsbalance',
                    dataType : 'json',
                    success: function(_d) {
                        if(_d.s == -2){
                            alert("查询余额失败,请稍后再查询");
                        }else{
                            $('#balance').text('当前短信余额为' + _d.s);
                        }
                    }
                });
            }
        })
    })
</script>